<?php
/**
 * Author: zhangkang
 * Date: 2016/12/2910:44
 * Description:
 */
//header('Content-Type:text/html; charset=gb2312');//使用gb2312编码，使中文不会变成乱码

require 'common.inc.php';
set_cookie('mobile', 'pc', $DT_TIME + 30 * 86400);
$openid = decrypt(get_cookie('weixin_openid'), DT_KEY.'WXID');
log_write('openid =>:'.$openid);
//订阅的地区淡出处理
if($scope){
	$diqu=explode(",",$scope);
	$aa='';
	foreach($diqu as $a=>$b){
	 $dq= $db->get_one("select areaid from {$DT_PRE}area WHERE areaname like '%".$b."%'");
	 $aa.=$dq['areaid'].",";
	}
	if($aa){$_POST['filteraddress']=rtrim($aa, ",");}
}else{
	$_POST['filteraddress']=-1;
	}
$filteraddress = $_POST['filteraddress'];
if (isset($filteraddress)&&!empty($filteraddress)) {
    //不支持全选 行业
    if ($filteraddress==-1) {
        $filteraddress = null;
    }
    $result = $db->query("UPDATE {$DT_PRE}weixin_user SET filteraddress='$filteraddress' WHERE openid='$openid'");
}
//单独处理修改地区的跳转
if($xgdq){

$url ="/mobile/zbdy.php"; 
Header("Location:$url");
	}

echo $result;
exit;
//include template('weixinuser', 'mobile');
//if(DT_CHARSET != 'UTF-8') toutf8();
?>